/* Edit VM Dialog - Podman Desktop Style */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--dark-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease-out;
}

.edit-vm-modal {
  max-width: 500px;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--current-line);
  border-radius: 12px 12px 0 0;
}

.modal-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.vm-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--background);
}

.modal-title-info h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--light-text);
}

.vm-name-display {
  margin: 4px 0 0 0;
  font-size: 0.9rem;
  color: var(--gray-text);
  font-weight: 400;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-text);
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--background);
  color: var(--light-text);
}

.modal-close:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.vm-edit-form {
  padding: 24px;
}

.form-content {
  margin-bottom: 24px;
}

.form-section {
  margin-bottom: 24px;
}

.form-section h3 {
  margin: 0 0 20px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--light-text);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--light-text);
  font-size: 0.9rem;
}

.form-label .required {
  color: var(--danger-color);
  margin-left: 4px;
}

.form-label .unit {
  color: var(--gray-text);
  margin-left: 4px;
  font-weight: 400;
}

.input-wrapper {
  position: relative;
}

.form-group input[type="text"],
.form-group input[type="number"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--current-line);
  color: var(--light-text);
  transition: all 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(189, 147, 249, 0.2);
}

.form-group input.error {
  border-color: var(--danger-color);
  box-shadow: 0 0 0 3px rgba(255, 85, 85, 0.2);
}

.form-group input:disabled {
  background: var(--background);
  color: var(--gray-text);
  cursor: not-allowed;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0 !important;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.checkbox-text {
  margin-bottom: 0 !important;
  font-weight: 400 !important;
}

.error-message {
  display: block;
  color: var(--danger-color);
  font-size: 0.8rem;
  margin-top: 6px;
  font-weight: 500;
}

.global-error {
  background: rgba(255, 85, 85, 0.1);
  border: 1px solid rgba(255, 85, 85, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-weight: 500;
  color: var(--danger-color);
}

.info-banner {
  background: rgba(139, 233, 253, 0.1);
  border: 1px solid rgba(139, 233, 253, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: var(--cyan);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.info-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  margin-top: 24px;
}

.btn-primary,
.btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary-color);
  color: var(--background);
}

.btn-primary:hover:not(:disabled) {
  background: #a278f0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(189, 147, 249, 0.3);
}

.btn-primary:disabled {
  background: var(--gray-text);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--current-line);
  color: var(--light-text);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--background);
  transform: translateY(-1px);
  border-color: var(--primary-color);
}

.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.loading-spinner {
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal-footer {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }

  .modal-header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
  .modal-content {
    background: var(--bg-primary-dark, #1e1e1e);
    color: var(--text-primary-dark, #ffffff);
  }

  .modal-header {
    background: var(--bg-secondary-dark, #2d2d2d);
    border-bottom-color: var(--border-color-dark, #404040);
  }

  .modal-header h2 {
    color: var(--text-primary-dark, #ffffff);
  }

  .form-group input[type="text"],
  .form-group input[type="number"] {
    background: var(--bg-input-dark, #2d2d2d);
    border-color: var(--border-color-dark, #404040);
    color: var(--text-primary-dark, #ffffff);
  }

  .form-group input:focus {
    border-color: var(--primary-color, #0066cc);
  }

  .btn-secondary {
    background: var(--secondary-bg-dark, #2d2d2d);
    color: var(--text-primary-dark, #ffffff);
    border-color: var(--border-color-dark, #404040);
  }

  .info-message {
    background: var(--info-bg-dark, #1a3a42);
    border-color: var(--info-border-dark, #2d5a66);
    color: var(--info-color-dark, #a8d8e6);
  }
}